﻿using System;

namespace AutomaticScrewLocking.domain.modbus.comm.service
{
    public interface PlcCommunicationService
    {
        /// <summary>
        /// 连接PLC
        /// </summary>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        bool ConnectPlc(out string errorMsg);

        /// <summary>
        /// 断开PLC
        /// </summary>c
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        bool DisConnectPlc(out string errorMsg);

        /// <summary>
        /// 读取保持寄存器开始信号
        /// </summary>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        int ReadStartSignal(out bool result, out string errorMsg);

        /// <summary>
        /// 读取保持寄存器结束信号
        /// </summary>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        int ReadEndSignal(out bool result, out string errorMsg);

        /// <summary>
        /// 写保持寄存器开始信号
        /// </summary>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        bool writeStartSignal(out string errorMsg);

        /// <summary>
        /// 写保持寄存器结束信号
        /// </summary>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        bool WriteEndSignal(out string errorMsg);


        /// <summary>
        /// 设置锁付开始Z轴位置
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        bool WriteStartPosZ(float pos, out string errorMsg);

        /// <summary>
        ///  设置锁付结束Z轴位置
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        bool WriteEndPosZ(float pos, out string errorMsg);

    }
}
